package com.scalar.forecast.columnDisplay;

import java.util.Comparator;


/**
 * Created by Veeru. 
 * Date: Feb 17, 2005
 * Time: 12:15:57 PM 
 */

 // This Class is used to compare the ColumnMetaData Objects based on order attribute

public class SearchMetaDataComparator implements Comparator {

    public int compare ( Object o1, Object o2 ) {

        int result = 0;
        if ( ! ( o1 instanceof ColumnMetaData ) || ! (o2 instanceof ColumnMetaData ) ) {
            throw new ClassCastException();
        }
        ColumnMetaData columnMetaData1 = ( ColumnMetaData )o1;
        ColumnMetaData columnMetaData2 = ( ColumnMetaData )o2;
        result = columnMetaData1.getOrder() - columnMetaData2.getOrder();
        return result;
    }
}
